home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_01 / allison / tintset.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-07  |  1.0 KB  |  48 lines

  1. //tintset.cpp
  2. #include <iostream.h>
  3. #include "intset.h"
  4.  
  5. main()
  6. {
  7.     Intset<16> x, y;
  8.  
  9.     for (int i = 0; i < 10; ++i)
  10.     {
  11.         x.insert(i);
  12.         if (i % 2)
  13.             y.insert(i);
  14.     }
  15.  
  16.     cout << "x == " << x << endl;
  17.     cout << "y == " << y << endl;
  18.     cout << "y <= x? " << (y <= x) << endl;
  19.     cout << "y >= x? " << (y >= x) << endl;
  20.     cout << "x - y == " << x - y << endl;
  21.     cout << "x + y == " << x + y << endl;
  22.     cout << "x * y == " << x * y << endl;
  23.     cout << "~x == " << ~x << endl;
  24.     cout << "x.contains(2)? " << x.contains(2) << endl;
  25.     cout << "y.contains(2)? " << y.contains(2) << endl;
  26.     cout << "x.count() == " << x.count() << endl;
  27.     cout << "y.count() == " << y.count() << endl;
  28.     return 0;
  29. }
  30.  
  31. /* Output:
  32. x == {0,1,2,3,4,5,6,7,8,9}
  33. y == {1,3,5,7,9}
  34. y <= x? 1
  35. y >= x? 0
  36. x - y == {0,2,4,6,8}
  37. x + y == {0,1,2,3,4,5,6,7,8,9}
  38. x * y == {1,3,5,7,9}
  39. ~x == {10,11,12,13,14,15}
  40. x.contains(2)? 1
  41. y.contains(2)? 0
  42. x.count() == 10
  43. y.count() == 5
  44. */
  45.  
  46. // End of File
  47.  
  48.